package br.com.usp.server;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import br.com.usp.shared.BMMDTO;


@Entity(name="TB_ACTIVITY_FLOW")
public class ActivityFlow {


	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="ID_FLOW")
    private int id;
	
	@Column(name="Nome")
	private String Descricao;
	
	@Column
    private String Tipo;
	
    @Column(name="Descricao")
    private String Representacao;
    
    @Column(name="ESQ")
	private int  left;
    
    @Column(name="CIMA")
	private int   top;

    @ManyToOne 
    @JoinColumn(name="ID_PROCESS", referencedColumnName="ID_FLOW") 
    private ProcessFlow processo;
    
    @OneToMany(cascade=CascadeType.ALL ,mappedBy="activity")
   	private List<TaskFlow> listaTask;

    @OneToMany(cascade=CascadeType.ALL ,mappedBy="de")
    private List<ConnectorActivity> listaConnectorActivityDe;
    
    @OneToMany(cascade=CascadeType.ALL ,mappedBy="para")
    private List<ConnectorActivity> listaConnectorActivityPara;
	
    
    @OneToMany(cascade=CascadeType.ALL ,mappedBy="activity")
  	private List<ConnectorTask> connectorTask;
    
    public ActivityFlow()
    {
    	listaTask = new ArrayList<TaskFlow>(); 
    	connectorTask = new ArrayList<ConnectorTask>(); 
    	listaConnectorActivityPara = new ArrayList<ConnectorActivity>();
    	listaConnectorActivityDe = new ArrayList<ConnectorActivity>();
    }
    
    
    public ActivityFlow(BMMDTO bmm)
    {
    	this.id = bmm.getId();
    	this.Descricao = bmm.getDescricao();
    	this.Tipo = bmm.getTipo();
        this.Representacao = bmm.getRepresentacao();
        this.left = bmm.getLeft();
        this.top = bmm.getTop();
        listaTask = new ArrayList<TaskFlow>(); 
        connectorTask = new ArrayList<ConnectorTask>(); 
    	listaConnectorActivityPara = new ArrayList<ConnectorActivity>();
    	listaConnectorActivityDe = new ArrayList<ConnectorActivity>();
    }

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDescricao() {
		return Descricao;
	}

	public void setDescricao(String descricao) {
		Descricao = descricao;
	}

	public String getTipo() {
		return Tipo;
	}

	public void setTipo(String tipo) {
		Tipo = tipo;
	}

	public String getRepresentacao() {
		return Representacao;
	}

	public void setRepresentacao(String representacao) {
		Representacao = representacao;
	}

	public int getLeft() {
		return left;
	}

	public void setLeft(int left) {
		this.left = left;
	}

	public int getTop() {
		return top;
	}

	public void setTop(int top) {
		this.top = top;
	}

	public ProcessFlow getProcesso() {
		return processo;
	}

	public void setProcesso(ProcessFlow processo) {
		this.processo = processo;
	}

	public List<TaskFlow> getListaTask() {
		return listaTask;
	}

	public void setListaTask(List<TaskFlow> listaTask) {
		this.listaTask = listaTask;
	}

	public List<ConnectorActivity> getListaConnectorActivityDe() {
		return listaConnectorActivityDe;
	}

	public void setListaConnectorActivityDe(
			List<ConnectorActivity> listaConnectorActivityDe) {
		this.listaConnectorActivityDe = listaConnectorActivityDe;
	}

	public List<ConnectorActivity> getListaConnectorActivityPara() {
		return listaConnectorActivityPara;
	}

	public void setListaConnectorActivityPara(
			List<ConnectorActivity> listaConnectorActivityPara) {
		this.listaConnectorActivityPara = listaConnectorActivityPara;
	}

	public List<ConnectorTask> getConnectorTask() {
		return connectorTask;
	}

	public void setConnectorTask(List<ConnectorTask> connectorTask) {
		this.connectorTask = connectorTask;
	}
    
    
	
	
}
